import React from 'react';
import Icon from '@/components/Icon';
import {flattenRoutes} from '@/utils';
import type {TabRouteProps, StackRouteProps} from './types';

// tab 路由
import Home from '@/app/(tabs)/home';
import Profile from '@/app/(tabs)/profile';

// stack 路由
import Login from '@/app/(views)/auth/login';
import Register from '@/app/(views)/auth/register';
import LoanOcr from '@/app/(views)/loan/ocr';
import LoanRecord from '@/app/(views)/loan/record';

// Tab 导航
export const tabRoutes: TabRouteProps[] = flattenRoutes([
  {
    path: '/home',
    element: Home,
    options: {
      tabBarLabel: 'หน้าหลัก',
      tabBarIcon: ({focused, size}) => {
        return <Icon name="home" size={size} focused={focused} />;
      },
    },
  },
  {
    path: '/profile',
    element: Profile,
    options: {
      tabBarLabel: 'โปรไฟล์',
      tabBarIcon: ({focused, size}) => {
        return <Icon name="personal" size={size} focused={focused} />;
      },
    },
  },
]);

// Auth 导航
export const authRoutes: StackRouteProps[] = flattenRoutes([
  {
    path: '/auth',
    children: [
      {
        path: '/login',
        element: Login,
      },
      {
        path: '/register',
        element: Register,
      },
    ],
  },
]);

// Stack 导航
export const stackRoutes: StackRouteProps[] = flattenRoutes([
  {
    path: '/loan',
    children: [
      {
        path: '/ocr',
        element: LoanOcr,
      },
      {
        path: '/record',
        element: LoanRecord,
      },
    ],
  },
]);
